package com.jkl.service.index;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jkl.dao.index.PJIndexMapper;
import com.jkl.entity.index.PJIndex;
import com.jkl.service.index.inter.IPJIndexServiceInterface;

@Service
public class PJIndexService implements IPJIndexServiceInterface {

	@Autowired
	private PJIndexMapper indexMapper;

	@Override
	public List<PJIndex> queryIndexByYearAndDeptParentId(PJIndex pjIndex) {
		
		return indexMapper.queryIndexByYearAndDeptParentId(pjIndex);
	}

	@Override
	public void saveIndexList(List<PJIndex> pjIndexList) {
		for(PJIndex index : pjIndexList){
			if (index.getRowId() == null) {
				indexMapper.insertPJIndex(index);
			} else {
				indexMapper.updatePJIndex(index);
			}
		}
	}

}
